        // add dedicated css
        // noswfupload.css("/scripts/noswfupload/noswfupload.css", "/scripts/noswfupload/noswfupload-icons.css");
        
            onload = function(){
                var
                    // the input type file to wrap
                    input   = document.getElementById("u_file"),
                    
                    // the submit button
                    submit  = document.getElementById("u_submit"),
                    
                    // the form
                    form    = document.getElementById("u_form"),
                    
                    // the form action to use with noswfupload
                    url     = form.getAttribute("action") || form.action,
                    
                    // noswfupload wrap Object
                    wrap;
                
                
                // if we do not need the form ...
                    // move inputs outside the form since we do not need it
                    with(form.parentNode){
                        appendChild(input);
                        appendChild(submit);
                    };
                    
                    // remove the form
                    form.parentNode.removeChild(form);
                
                // create the noswfupload.wrap Object with 1Mb of limit
                wrap = noswfupload.wrap(input, 1024 * 1024 * 10);
                //alert (input);
                //alert (wrap.files);
                //for (k in wrap.files)alert (k+' '+wrap.files[k]);
                // form and input are useless now (remove references)
                form = input = null;
                
                // assign event to the submit button
                noswfupload.event.add(submit, "click", function(e){
                    
                    // only if there is at least a file to upload
                    if(wrap.files.length){
                        submit.setAttribute("disabled", "disabled");
                        //for (k in wrap.files) alert (k+' '+wrap.files[k]);
                        wrap.upload(
                            // it is possible to declare events directly here
                            // via Object
                            // {onload:function(){ ... }, onerror:function(){ ... }, etc ...}
                            // these callbacks will be injected in the wrap object
                            // In this case events are implemented manually
                        );
                    } else
                        noswfupload.text(wrap.dom.info, "Не выбраны файлы");
                    
                    submit.blur();
                    
                    // block native events
                    return  noswfupload.event.stop(e);
                });
                
                // set wrap object properties and methods (events)
                
                // url to upload files
                wrap.url = url;
                
                // accepted file types (filter)
                 //wrap.fileType = "Images (*.jpg, *.jpeg, *.png, *.gif, *.bmp, *.pdf, *.doc, *.docx, *.xls, *.xlsx, *.rtf, *.ppt)";
                // fileType could contain whatever text but filter checks *.{extension} if present
                
                // handlers
                wrap.onerror = function(){
                    noswfupload.text(this.dom.info, "ВНИМАНИЕ: Не могу загрузить файл " + this.file.fileName);
                };
                
                // instantly vefore files are sent
                wrap.onloadstart = function(){
                
                    // we need to show progress bars and disable input file (no choice during upload)
                    this.show(0);
                    
                    // write something in the span info
                    noswfupload.text(this.dom.info, "Подготовка к загрузке ... ");
                    $('#checkd').attr('ref','not');
                };
    
                // event called during progress. It could be the real one, if browser supports it, or a simulated one.
                wrap.onprogress = function(rpe, xhr){
                this.file.fileName
                    // percent for each bar
                    this.show((this.sent + rpe.loaded) * 100 / this.total, rpe.loaded * 100 / rpe.total);
                    
                    // info to show during upload
                    noswfupload.text(this.dom.info, "Загрузка: " + this.file.fileName);
                    
                    // fileSize is -1 only if browser does not support file info access
                    // this if splits recent browsers from others
                    if(this.file.fileSize !== -1){
                        // simulation property indicates when the progress event is fake
                        if(rpe.simulation)
                            // in this case sent data is fake but we still have the total so we could show something
                            noswfupload.text(this.dom.info,
                                "Загружаю: " + this.file.fileName,
                                "Всего: " + noswfupload.size(this.sent + rpe.loaded) + " из " + noswfupload.size(this.total)
                            );
                        else
                            // this is the best case scenario, every information is valid
                            noswfupload.text(this.dom.info,
                                "Загружаю: " + this.file.fileName,
                                "Отправлено: " + noswfupload.size(rpe.loaded) + " из " + noswfupload.size(rpe.total),
                                "Всего: " + noswfupload.size(this.sent + rpe.loaded) + " из " + noswfupload.size(this.total)
                            );
                    } else
                        // if fileSIze is -1 browser is using an iframe because it does not support
                        // files sent via Ajax (XMLHttpRequest)
                        // We can still show some information
                        noswfupload.text(this.dom.info,
                            "Загружаю: " + this.file.fileName,
                            "Отправлено: " + (this.sent / 100) + " из " + (this.total / 100)
                        );
                };
    
                // generated if there is something wrong during upload
                wrap.onerror = function(){
                    // just inform the user something was wrong
                    noswfupload.text(this.dom.info, "ВНИМАНИЕ: Не могу загрузить файл " + this.file.fileName);
                };
    
                // generated when every file has been sent (one or more, it does not matter)
                wrap.onload = function(rpe, xhr){
                    var self = this;
                    // just show everything is fine ...
                    noswfupload.text(this.dom.info, "Загрузка завершена");
                    
                    
                    // ... and after a second reset the component
                    setTimeout(function(){
                        self.clean();   // remove files from list
                        self.hide();    // hide progress bars and enable input file
                        $('#checkd').removeAttr('ref');
                        reloadThumbs();
                        
                        noswfupload.text(self.dom.info, "");
                        
                        // enable again the submit button/element
                        submit.removeAttribute("disabled");
                    }, 1000);
                };
    
            };